home *** CD-ROM | disk | FTP | other *** search
/ Freaks Macintosh Archive / Freaks Macintosh Archive.bin / Freaks Macintosh Archives / Phreaking⁄Wardialers / Term Applications / BlackNight1.0.4.sit / BlackNight1.0.4 / Scripting Changes < prev    next >
Text File  |  1995-11-11  |  2KB  |  33 lines

  1. AppleScript Interface - Summary of Changes
  2.  
  3. The 'classic' method of scripting a connection attempt goes something like this:
  4.  
  5. tell application "Black Night 1.0.4"
  6.     open helper "Atlantis"
  7.     wait until connection of document "Atlantis" becomes active timeout 50
  8.     if not result then return "Unable to Connect"
  9.     return ""
  10. end tell
  11.  
  12. If the connection attempt failed, then the "Wait" command would timeout after 50 seconds and get captured as a generic failure.
  13.  
  14. This script will still work, but now you can also do this:
  15.  
  16. tell application "Black Night 1.0.4"
  17.     open helper "Atlantis"
  18.     wait until connection of document "Atlantis" becomes idle timeout 50
  19.     if not result then return "Out to Lunch"
  20.     set localResult to errcode of connection of document "Atlantis"
  21.     --- -128 is user canceled
  22.     if localResult is equal to -128 then return "You canceled !"
  23.     --- 0 is usually success, you may want to check the status though
  24.     if localResult is equal to 0 then return ""
  25.     --- some other error - report it
  26.     return localResult
  27. end tell
  28.  
  29. The change is the addition of the "errcode" property which returns the error code returned by the connection tool after the last connection attempt. Note that connection tools are rather sparodic in the manner in which they return error codes and hence this is not 100% reliable. If you're really paranoid then you should check the status of the connection to make sure it really is open.
  30.  
  31. The other change is the "status" property now includes an enumeration "idle", which means that it's either connected or not connected. This enumeration is only referenced by the wait command (i.e. if you read the status directly - you will not get "idle" returned).
  32.  
  33.